package com.irdstudio.apicenter.console.service.authenticate;

import java.sql.SQLException;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.irdstudio.apicenter.console.dm.AppRole;
import com.irdstudio.apicenter.console.dm.AppRoleDao;

@Service(value = "appRoleService")
public class AppRoleService {

	@Autowired
	private AppRoleDao appRoleDao;

	public int insertOne(AppRole appRole) throws SQLException,
			ClassNotFoundException {
		return appRoleDao.saveAppRole(appRole);
	}

	public AppRole queryAppRoleDetail(String appId, String appRoleId)
			throws SQLException {
		return appRoleDao.queryWithKeys(appId, appRoleId);
	}

	public int update(AppRole appRole) throws SQLException,
			ClassNotFoundException {
		return appRoleDao.update(appRole);
	}

	public int delete(String appId, String appRoleId) throws SQLException {
		return appRoleDao.delete(appId, appRoleId);
	}

	public List<AppRole> queryByAppID(String appId) throws SQLException {
		return appRoleDao.queryByAppID(appId);
	}
}
